#include "Solution.h"
#include <iostream>

using namespace std;

int main()
{
	int n,k;
	cin>>n>>k;
	
	Solution s;
	string result = s.getPermutation(n,k);
	cout<<result;
	while(cin.get() != '\n');
	cin.get();
}